const { Menu, dialog } = require("electron");
const os = require("os");
const version = require("../../package.json").version;

import Vue from "vue";
let v = new Vue();

let status = false;
var template = [
  {
    label: "设置",
    submenu: [
      { label: "快速重启", accelerator: "F6", role: "reload" },
      {
        label: "最小化当前窗口",
        accelerator: "CmdOrCtrl+F3",
        role: "minimize",
      },
      { label: "退出", accelerator: "CmdOrCtrl+F4", role: "close" },
    ],
  },
  {
    label: "帮助",
    submenu: [
      {
        label: "关于",
        role: "about",
        click() {
          dialog.showMessageBox({
            title: "关于",
            type: "info",
            message: "Vue x Electron",
            detail: `版本信息：${version}\n引擎版本：${process.versions.v8
              }\n当前系统：${os.type()} ${os.arch()} ${os.release()}`,
            noLink: true,
            buttons: ["确定"],
          });
        },
      },
    ],
  },
];

if (process.env.NODE_ENV === "development") {
  template.push({
    label: "开发者设置",
    submenu: [
      {
        label: "切换到开发者模式",
        accelerator: "F12",
        role: "toggledevtools",
      },
    ],
  });
}

var m = Menu.buildFromTemplate(template);

Menu.setApplicationMenu(m);
